fix: normalize provider-prefixed model names in extractModel()#24
Open
sven-ea-assistant wants to merge 2 commits intoatalovesyou:mainfrom
Open
fix: normalize provider-prefixed model names in extractModel()#24sven-ea-assistant wants to merge 2 commits intoatalovesyou:mainfrom
sven-ea-assistant wants to merge 2 commits intoatalovesyou:mainfrom
Conversation
Strip any <provider>/ prefix before MODEL_MAP lookup, not just the hardcoded 'claude-code-cli/' prefix. This ensures requests with model names like 'claude-max/claude-sonnet-4' correctly map to 'sonnet' instead of falling back to the opus default. Changes: - Replace fixed /^claude-code-cli\// regex with /^[^/]+\// to handle any provider prefix generically - Remove now-redundant hardcoded 'claude-code-cli/*' entries from MODEL_MAP (covered by the generic prefix strip) - Add src/adapter/openai-to-cli.test.ts with 5 tests covering unprefixed names, claude-code-cli/ prefix, claude-max/ prefix, short aliases, and unknown-model fallback Fixes atalovesyou#23
…zation - Add Semaphore + RequestTracker for concurrent subprocess limiting (default 5) - Wire concurrency module into routes.ts with acquire/release around CLI calls - Expose active/waiting/capacity stats on /health endpoint - Fix [object Object] bug: contentToString() handles array content parts - Add OpenAIContentPart type, support array content in OpenAIChatMessage - Normalize provider-prefixed model names in extractModel() - Add --permission-mode bypassPermissions to spawned Claude subprocesses Closes atalovesyou#23 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chrisle
added a commit
to chrisle/claude-max-api-proxy
that referenced
this pull request
Feb 27, 2026
Users can now send large prompts without E2BIG errors, use array-based content format for multimodal support, properly handle system prompts, and receive token usage data in streaming responses. Model names with any provider prefix are now correctly normalized. Changes: - Fix array content serialization preventing [object Object] bugs - Pass prompts via stdin to prevent E2BIG errors with large requests - Add proper system prompt support via --append-system-prompt flag - Include usage data in final streaming chunks - Support any provider prefix in model names (claude-max/, etc.) - Add CLAUDE_DANGEROUSLY_SKIP_PERMISSIONS env var for service mode - Update to Claude 4.5/4.6 model support Incorporates improvements from PRs atalovesyou#12, atalovesyou#13, atalovesyou#16, atalovesyou#24, atalovesyou#27 at https://github.com/atalovesyou/claude-max-api-proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
extractModel()only stripped the hardcodedclaude-code-cli/prefix, so model names likeclaude-max/claude-sonnet-4remained prefixed, failed theMODEL_MAPlookup, and fell back toopus.Root Cause
The regex
/^claude-code-cli\//only matched one specific provider prefix.Changes
src/adapter/openai-to-cli.ts/^claude-code-cli\//with/^[^/]+\//to strip any<provider>/prefix genericallyclaude-code-cli/*entries fromMODEL_MAP(covered by generic strip)src/adapter/openai-to-cli.test.ts(new file)claude-sonnet-4→sonnet)claude-code-cli/prefix (existing behavior preserved)claude-max/prefix (new — the bug fix)sonnet,opus,haiku)opusTest Results
Fixes #23